
//////////////////////////////////////////////////////////////////////////////////////

class LoadingUI extends egret.Sprite {

    public constructor() {
        super();
        this.createView();
    }

    private textField: egret.TextField;

    private createView(): void {
        RES.getResByUrl("resource/assets/loading.png", function (texture) {
            //预加载logo图片
            var bg = new egret.Bitmap();
            bg.texture = texture;
            bg.x = 0;
            this.addChild(bg);
        }, this);

        this.textField = new egret.TextField();
        this.addChild(this.textField);
        this.textField.y = 300;
        this.textField.width = 480;
        this.textField.height = 100;
        this.textField.textAlign = "center";
    }

    public setProgress(current: number, total: number): void {
        //进度提示
        var percent = Math.ceil(current / total * 100);
        this.textField.text = `Loading...${percent}%`;
    }
}
